<?php
/**
 *
 *
 *
 */
namespace Yz\modules\Users;
class Model_User
    extends Model_Default
{
    const DEFAULT_ITEM = 'User';


    /**
     *  @param string $login
     *  @return \ns\Item_User
     *  @throws ItemNotFound
     */
    public function fetchUserByLogin($login)
    {
        debug();
        $action = $this
            ->selectAction('SelectByLogin')
            ->setLogin($login)
        ;

        return $this->_fetch( $action );
    }

    /**
     *  @param \ns\Item_User $user
     *  @return chainable
     *  @throws ItemNotFound
     */
    public function updateUserLoginTime(Item_User $user)
    {
        debug();

        // avoid update password
        $u = $this->selectItem('Default');
        $u->assignValues($user);
        return $this->updateItemById($u);
    }

} // class
